package com.tianquan.spring;/**
 * @author starsea
 * @date 2024-09-09 下午4:31
 */

import jakarta.annotation.PostConstruct;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @BelongsProject: uploaddemo
 * @BelongsPackage: com.tianquan
 * @Author: tianquan
 * @CreateTime: 2024-09-09  16:31
 * @Description: 测试
 * @Version: 1.0
 */

@Component
public class Bean implements InitializingBean, ApplicationContextAware, BeanNameAware {

    public Bean() {
        System.out.println("实例化 无参构造");
    }

    @PostConstruct
    public void PostConstruct() {
        System.out.println("初始化---->PostConstruct()");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("初始化---->afterPropertiesSet()");
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        System.out.println("初始化---->setApplicationContext()");
    }

    @Override
    public void setBeanName(String name) {
        System.out.println(name);
    }
}
